//
//  Shape.cpp
//  RayTracer
//
//  Created by 俞云康 on 2/15/16.
//  Copyright © 2016 yushroom. All rights reserved.
//

#include "Shape.hpp"
#include "Log.hpp"
#include "Timer.hpp"
#include <iostream>
#include <map>
#include "Sphere.hpp"
#include "Plane.hpp"
#include "Disk.hpp"
#include "TriangleMesh.hpp"
#include "Params.hpp"

using namespace std;


shared_ptr<Shape> Shape::create(const Params& params) {
    string name = params.getID();
    string type = params.getType();
    shared_ptr<Shape> s;
    if (type == "sphere") {
        s = Sphere::create(params);
    } else if (type == "plane") {
        s = Plane::create(params);
    } else {
        error("unknown shape type: %s\n", type.c_str());
    }
    return s;
}
